package cn.edu.ncut.cs.springboot.mybatisplusemployee.service.impl;

import cn.edu.ncut.cs.springboot.mybatisplusemployee.entity.Employees;
import cn.edu.ncut.cs.springboot.mybatisplusemployee.mapper.EmployeesMapper;
import cn.edu.ncut.cs.springboot.mybatisplusemployee.service.IEmployeesService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author ncut
 * @since 2024-12-24
 */
@Service
public class EmployeesServiceImpl extends ServiceImpl<EmployeesMapper, Employees> implements IEmployeesService {

    @Override
    public boolean removeEmployeeByNumber(Integer number) {
        QueryWrapper<Employees> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("number", number);
        return this.remove(queryWrapper);
    }

    @Override
    public Employees getEmployeeByNumber(Integer number) {
        QueryWrapper<Employees> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("number", number);
        return this.getOne(queryWrapper, false);
    }
}
